<%@ LANGUAGE="VBSCRIPT" %>
<%'  ------------------------------------------------------------
  '  mz_MVPMayPick.asp 
  '  ------------------------------------------------------------
  '  VCS INFO:
  '  
  '  $Revision:   1.19  $
  '  $Date:   08 Oct 1998 16:04:00  $
  '  $Author:   rurman  $
  '  $Workfile:   mz_MVPMayPick.asp  $
  '  ------------------------------------------------------------
  '  All Rights Reserved.  Copyright (c) 1988-1998 FileNET Corp.
  '  ------------------------------------------------------------
  '%>
<!-- #include file="islogon.asp" -->
<!-- #include file="jscriptfix.asp" -->
<!-- #include file="checkutil.asp" -->

<%
DebugFlag = 0

RequestMethod = Request.ServerVariables("REQUEST_METHOD")
if RequestMethod = "POST" then
%>
<%
    ObjType = CInt(Request.Form("Type"))
    Ident = Request.Form("Ident")
    CheckIn = Request.Form("CheckIn")   ' Yes / No
    PropIndex = Request.Form("PropIndex")
    Update = Request.Form("Update")
else
    ObjType = CInt(Request.QueryString("Type"))
    Ident  = Request.QueryString("Ident")
    CheckIn = Request.QueryString("CheckIn")
    PropIndex = Request.QueryString("PropIndex") 
    Update = Request.QueryString("Update")
end if
' Status = Request.QueryString("Status")

'Panagon IDM Web application uses the Session variable LibraryLogonID to keep track of
'whether the user has logged on.
'Please see logoncall.asp to see how the Session variable LibraryLogonID is set.
LibraryLogonID = Session("LibraryLogonID")
set LibraryObj = Server.CreateObject("IDMObjects.Library")
LibraryObj.LogonID = LibraryLogonID
%>


<% if DebugFlag then %>
Form<br>
<% For Each x In Request.Form %>
<!-- <INPUT TYPE=hidden name="<%= x %>" value="<%= Request.Form(x) %>"> -->
name="<%= x %>" value="<%= Request.Form(x) %>"<br>
<% Next %>
Ident=<%= Ident%>, PropIndex=<%=PropIndex%><br>
<%end if %>

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Property Modify</title>
</head>

<body bgcolor="#FFFFFF">

<%
' get the document object
set FObj = LibraryObj.GetObject(1, Ident) ' ObjType, Ident)

' get the current MultiValue Property object 
set Props = FObj.Properties

set Prop = Props.Item(PropIndex)
set PropDesc = Prop.PropertyDescription
%>


<table border="0" cellpadding="4" cellspacing="0">
    <tr>
        <td nowrap><% if ObjType = Application("idmObjTypeDocument") then %><img src="images/ldoc.gif" width="34" height="39"><% else %><img
        src="images/lfolder.gif" width="38" height="39"><% end if %><font
        size="3"><strong><%= Ident %> ("<%=Server.HTMLEncode(FObj.Label) %>") :  </strong> </font>
        <font size="3"><strong>  Modify Multi Valued Property: "<%= Server.HTMLEncode(PropDesc.Label) %>" </strong> </font>
        </td>
    </tr>
</table>

<%
' this page can be called from the Checkin Page or the Modify Properties Page, 
' so the Submit action should take you back to the originating page
%>

<form name="property" <%if Checkin="Yes" then %> action="doccheckin.asp" target="View"<%else %> action="mz_propcontent.asp" target="PropContent" <%end if%> method="POST" >


<H3> Current Values</H3>
<table border="1" width="60%" cellpadding="0" cellspacing="1">
    <tr>
                
        <td align="center" width="100" bgcolor="#EECCFF"><font size="3"><strong>Value</strong></font></td>
        <td align="center" width="100" bgcolor="#EECCFF"><font size="3"><strong>Delete</strong></font></td>
                
    </tr>
    
    <% 
    ' Property values are sent as pairs of 
    ' "DELETE_xxx=n" where n is the index in the current list of values, and
    ' "ADD_xxx=valn" where valn is the new entered value
    set MVProp = Prop.Value ' object is a MultipleValues
    delStr = "DELETE_" + UCase(Prop.Name)
    addStr = "ADD_" + UCase(Prop.Name)
%>

<% if DebugFlag then
        For k=1 to Request.Form(delStr).Count
            if not (Request.Form(delStr)(k) = "") then
        %>  
            <%= prop.Name%> Delete <%=k%>, <%=Request.Form(delStr)(k) %><br>
        <%
            end if
        next
    end if 
%>

<%  
    ' loop through the existing list of values
    ' the checkbox allows to delete the value
    for i=1 to MVProp.Count
        StrVal = PropDesc.FormatValue(MVProp.Item(i))
    %>
    <tr>
    <td valign=bottom><em><%=StrVal%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</em></td>
    <td align=center><input type="checkbox" name="<%= delStr %>" value="<%=i%>"  
        <% For k=1 to Request.Form(delStr).Count
            if CInt(Request.Form(delStr)(k)) = i then
        %>  
            checked
        <%  exit for
            end if
          next %>
    ></td>
    </tr>
    <% next %>
</table>

<br>

<H3> New Values </H3>
<table cellpadding="0" cellspacing="1">
    <% 
    ' allow to add 5 new values for this property
    for i=1 to 5
        if ObjType = Application("idmObjTypeDocument") then
            FieldSize = PropDesc.Size
        else
            FieldSize = -1
        end if
    %>
        <tr>
        <td width="100%">
        <input type="text" size=100 name="<%= addStr %>"
            <% if FieldSize > 0 then %> maxlength=<%= FieldSize %>  <% end if %>
            <% if i <= Request.Form(addStr).Count then %> value="<%=Request.Form(addStr)(i)%>"
            <% else %> value="" <% end if %>
            <% if PropDesc.TypeID = Application("idmTypeDate") then %>
            onBlur="CheckDate(this, '<%=value%>')"
            <% elseif PropDesc.TypeID = Application("idmTypeUnsignedShort") or PropDesc.TypeID = Application("idmTypeUnsignedLong") _
                or PropDesc.TypeID = Application("idmTypeLong") or PropDesc.TypeID = Application("idmTypeShort") _ 
                or PropDesc.TypeID = Application("idmTypeSingle") then %>
            onBlur="CheckInteger(this, '<%=value%>')"
            <% end if %>
            >
        </td>
        </tr>
    <%
    

    next
    %>

</table>

<table border="0" cellpadding="0" cellspacing="1">
    <tr>
    <td width="30" valign=bottom align=right></td>
    <td>
    <% if not IsVirtual then %>
    <a href="javascript:Return()"><img alt="Return to Modify Properties" src="images/return.gif" align=bottom border=0 width=41 height=40></a><em><strong>Return</strong></em>
    <% end if %>
    </td>
    </tr>
</table>

<% 
' pass all the form elements
For Each x In Request.Form %>
<%  
    ' if not (Request.Form(x) = "") then ' pass also null strings
        if x<>delStr and x<>addStr then
%>
<% if DebugFlag then %>
INP hidden x= <%= x %>, addStr = <%= Request.Form(x) %><br>
<% end if %>
<%
            For k=1 to Request.Form(x).Count
%>
<INPUT TYPE=hidden name="<%= x %>" value="<%= Request.Form(x)(k) %>">
<%      
            next
        end if 
    ' end if
   Next %>

<input type="hidden" name="UpdateFlag" value="1">
</form>


<SCRIPT LANGUAGE="JavaScript">
<!--

function Return()
{
    // parse the delete checkboxes
    // parse the new values
    // no MORE button for now
    document.property.UpdateFlag.value = "1";
    document.property.submit();
}
//-->
</SCRIPT>

&nbsp;<br>
</body>
</html>
